package com.baturu.mybatisminus.enums;

/**
 * @author huangbin
 */
public enum BaseDaoSQL {
    /**
     * 增
     */
    SAVE("save", "<script>INSERT INTO %s (%s) \nVALUES (%s)</script>"),
    DYNAMIC_SAVE("dynamicSave", "<script>INSERT INTO %s (%s) \nVALUES (%s)</script>"),
    BATCH_SAVE("batchSave", "<script>INSERT INTO %s (%s) VALUES %s</script>"),

    /**
     * 删
     */
    DELETE_BY_ID("deleteById", "<script>DELETE FROM %s WHERE %s=%s</script>"),
    DELETE_BY_IDS("deleteByIds", "<script>DELETE FROM %s WHERE %s in %s</script>"),
    LOGIC_DELETE_BY_ID("logicDeleteById", "<script>UPDATE %s SET %s WHERE %s=%s</script>"),
    LOGIC_DELETE_BY_IDS("logicDeleteByIds", "<script>UPDATE %s SET %s WHERE %s in %s</script>"),
    
    /**
     * 改
     */
    UPDATE("update", "<script>UPDATE %s SET %s WHERE %s=%s</script>"),
    DYNAMIC_UPDATE("dynamicUpdate", "<script>UPDATE %s %s WHERE %s=%s</script>"),


    /**
     * 查
     */
    FIND_BY_ID("findById", "SELECT %s FROM %s WHERE %s=#{%s}"),
    FIND_BY_IDS("findByIds", "<script>SELECT %s FROM %s WHERE %s in %s</script>"),
    FIND_ALL("findAll", "<script>SELECT %s FROM %s</script>"),
    FIND_PAGE("findPage", "<script>SELECT %s FROM %s %s</script>"),
    COUNT("count", "<script>SELECT COUNT(*) FROM %s</script>");



    private final String methodName;
    private final String sql;

    BaseDaoSQL(final String method, final String sql) {
        this.methodName = method;
        this.sql = sql;
    }

    public String getMethodName() {
        return this.methodName;
    }

    public String getSql() {
        return this.sql;
    }

}
